﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NorthWin_Test.Biz;
using System.Collections;
using NorthWin_Test.Dao;
using NorthWin_Test.Entity;

namespace NorthWin_Test.form
{
    public partial class Update : Form
    {
        public Update()
        {
            InitializeComponent();
            UserBiz biz = new UserBiz();
            LoadData();
            
        }

        private void Update_Load(object sender, EventArgs e)
        {
            Button btn = new Button();
            btn.Name = "btnDisplay";
            btn.Text = "Display";
            btn.Location = new System.Drawing.Point(109, 187);
            this.Controls.Add(btn);

        }
        private void LoadData()
        {

            
            
            

            
            UserBiz biz = new UserBiz();
            foreach(UserEntity en in biz.GetAllUser())
            {
                
                DataGridViewTextBoxCell colUserID = new DataGridViewTextBoxCell();
                
                
                DataGridViewRow r = new DataGridViewRow();
                colUserID.Value = en.UserID;
                r.Cells.Add(colUserID);
                
                DataGridViewTextBoxCell colUserName = new DataGridViewTextBoxCell();
                colUserName.Value = en.UserName;
                r.Cells.Add(colUserName);

                dataGridView1.Rows.Add(r);
                
                

            }
            

            
            
            
            
        }
        private BindingSource _gridSource;

        private BindingSource GridSource
        {
            get
            {
                if (_gridSource == null)
                    _gridSource = new BindingSource();
                return _gridSource;
            }
        }


        private void listView11_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            
        }
        
    }
}
